package com.gaogao.java;

import java.util.Arrays;

public class TwoMonther {

    public static void main(String args[]){
        int[] a={1,4,6,22,26,45,57,68,99};
        Arrays.sort(a);
        System.out.println(two(a,45));

    }
    public static int two(int[] a,int value){
        int low=0;
        int hegh=a.length-1;

        while (low<=hegh){
           int mid=(hegh+low)/2;

            if(value==a[mid]){
                return mid;
            }
            if (value>a[mid]){
                low=mid+1;



            }
            System.out.println(low);
            if (value<a[mid]){
                hegh=mid-1;

            }


        }
     return -1;
    }
}
